/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package draftMate.player;

import draftMate.DraftMate;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author brianjob
 */
public class PitcherTable extends AbstractTableModel {
    private DraftMate draft;
    
    public PitcherTable(DraftMate dm) {
        draft = dm;
    }
    
    public int getColumnCount() {
        return draftMate.player.Pitcher.NUM_FIELDS;
    }
    
    public int getRowCount() {
        return draft.numPitchers();
    }
    
    public String getColumnName(int col) {
        switch(col) {
            case(Pitcher.NAME):
                return "Name";
            case(Pitcher.W):
                return "Wins";
            case(Pitcher.ERA):
                return "ERA";
            case(Pitcher.WHIP):
                return "WHIP";
            case(Pitcher.K):
                return "Ks";
            case(Pitcher.SV):
                return "Saves";
            default:
                return "ERROR";
        }
    }
    
    public Object getValueAt(int row, int col) {
        return draft.getPitcherStat(row, col);
    }
    
    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }
    
    public void setValueAt(Object value, int row, int col) {
        // maybe implement later
    }
    
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
    }
}
